#pragma once

#include <iostream>
#include <string>
#include <functional> 
#include <SimpleAmqpClient/SimpleAmqpClient.h>


using namespace AmqpClient;
using ConsumeCallback_t = std::function<bool(const std::string &)>;

struct MqConfig
{
    std::string exchange;
    std::string routingKey;
    std::string queue;

};

class MqProducer
{
public:
    MqProducer(const std::string &uri, const std::string &exchange, const std::string &routingKey);

    ~MqProducer() = default;

    bool PutMsg(const std::string &msg); // 传文件路径

private:
    MqConfig m_mconf;
    AmqpClient::Channel::ptr_t m_Channel;

};

class MqConsumer
{
public:
    MqConsumer(const std::string &uri, const std::string &queue);

    ~MqConsumer() = default;

    std::string GetMsg();

    void ConsumeLoop(ConsumeCallback_t ConsumeCallback);
private:
    MqConfig m_mconf;
    AmqpClient::Channel::ptr_t m_Channel;

};